﻿using DirectSell.IBLL;
using DirectSell.Model.Manager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DirectSell.BLL.Manager
{
    /// <summary>
    /// 后台管理服务层
    /// </summary>
    public class ManagerService:BaseService, IManagerOperation
    {
        #region 日志记录
        /// <summary>
        /// 日子记录文件夹
        /// </summary>
        protected override string LogFolder => "后台管理";
        /// <summary>
        /// 日志记录文件
        /// </summary>
        protected override string LogFile => "后台管理";

        #endregion

        #region 后台管理操作入口
        /// <summary>
        /// 后台管理操作入口
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        public virtual ManagerRespCode DoOperation<T>(T param)
        {
            return Operation<T>(param);
        }
        #endregion

        #region 后台管理操作入口 异步
        /// <summary>
        /// 后台管理操作入口 异步
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        public async virtual Task<ManagerRespCode> DoOperationAsync<T>(T param)
        {
            return await OperationAsync<T>(param);
        }
        #endregion

        #region 操作 
        /// <summary>
        /// 操作
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        protected virtual ManagerRespCode Operation<T>(T param)
        {
            return ManagerRespCode.成功;
        }
        #endregion

        #region 操作 -- 异步
        /// <summary>
        /// 操作 异步
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        protected async virtual Task<ManagerRespCode>OperationAsync<T>(T param)
        {
            return await Task.Run(()=> ManagerRespCode.成功);
        }
        #endregion

    }
}
